﻿namespace Sai.Core.Reporting
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using System.IO;
	
	public class FileReportOutput : IReportOutput
	{
		public FileReportOutput(string fileName)
		{
			if (string.IsNullOrEmpty(fileName))
				throw new ArgumentException();

            this.Path = fileName;
		}

        public string Path
        {
            get;
            private set;
        }

		private string FileName { get; set; }

		public void Execute(string reportContent)
		{
            if (File.Exists(this.Path))
			{
                File.Delete(this.Path);
			}

            using (var writer = new StreamWriter(this.Path))
			{
				writer.Write(reportContent);
			}
		}
	}
}
